import { configureStore } from '@reduxjs/toolkit'
import { TypedUseSelectorHook, useSelector } from 'react-redux'

import recommendReducer from './modules/recommend'
import musicplayerReducer from './modules/musicplayer'

const store = configureStore({
  reducer: {
    recommend: recommendReducer,
    musicplayer: musicplayerReducer
  }
})

type GetStateFnType = typeof store.getState
type IRootState = ReturnType<GetStateFnType>

export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector

export default store
